#!/usr/bin/env python 
# -*- coding:utf-8 -*-

import os
from six.moves import urllib
import zipfile
import re
from shutil import copyfile

import ssl
ssl._create_default_https_context = ssl._create_unverified_context

f = open('/Users/lipengxiang/Desktop/ec25e004d8274f89ba442979dd8feae7/ImageSets/Main/val.txt', 'r')
alllines = f.readlines()

for eachline in alllines:
    eachline = eachline.replace("\n", "")
    copyfile("/Users/lipengxiang/Desktop/ec25e004d8274f89ba442979dd8feae7/JPEGImages/" + eachline + ".jpg", "/Users/lipengxiang/Desktop/AI_/BoltNutDetection/boltNut/validation/images/" + eachline + ".jpg")
    copyfile("/Users/lipengxiang/Desktop/ec25e004d8274f89ba442979dd8feae7/Annotations/" + eachline + ".xml", "/Users/lipengxiang/Desktop/AI_/BoltNutDetection/boltNut/validation/annotations/" + eachline + ".xml")
f.close()